package com.qingjiang.projectschedule.controller;

import com.qingjiang.projectschedule.pojo.NodeDelay;
import com.qingjiang.projectschedule.service.NodeDelayService;
import com.qingjiang.projectschedule.utils.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("delay")
@CrossOrigin
public class DelayController {
    @Autowired
    private NodeDelayService delayService;

    @GetMapping("getDelayList")
    public Result getDelayList(@Param("page") Integer page, @Param("pageSize") Integer pageSize) {
        return delayService.getDelayList(page, pageSize);
    }

    @PostMapping("agreeApply")
    public Result agreeApply(@RequestBody NodeDelay nodeDelay) {
        return delayService.agreeApply(nodeDelay);
    }

    @PostMapping("disagreeApply")
    public Result disagreeApply(@RequestBody NodeDelay nodeDelay) {
        return delayService.disagreeApply(nodeDelay);
    }

    @GetMapping("getApplyResult")
    public Result getApplyResult(@Param("uid") Integer uid, @Param("page") Integer page, @Param("pageSize") Integer pageSize) {
        return delayService.getApplyResult(uid, page, pageSize);
    }

}
